/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function typeOperation() {
    var montant_max = document.getElementById('montant_max');
    var montant = document.getElementById('montant');
    var type_operation = document.getElementById('type_operation');
    var cpt_dest = document.getElementById('cpt_dest');
    var id_compte_cible = document.getElementById('id_compte_cible');
    if (type_operation.selectedIndex == 0 || type_operation.selectedIndex == 2) {
        montant.setAttribute('max', montant_max.value);
        if (montant.value > montant_max.value)
            montant.value=montant_max.value
    }
    else
        montant.setAttribute('max', '');
    
    if (type_operation.selectedIndex == 2)
        cpt_dest.style.display='block';
    else {
        cpt_dest.style.display='none';
        id_compte_cible.selectedIndex = 0;
    }
}